package com.yiqi.liebang.feature.home.view.adapter;

import com.baiiu.filter.ClassifyBo;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.framework.AM;
import com.yiqi.liebang.R;
import com.yiqi.liebang.entity.bo.LifeMenuSection;

import java.util.List;

public class ClassifyAdapter extends BaseSectionQuickAdapter<LifeMenuSection, BaseViewHolder> {


    public ClassifyAdapter(List<LifeMenuSection> data) {
        super(R.layout.item_classify_content, R.layout.item_classify_head, data);
    }

    @Override
    protected void convertHead(BaseViewHolder helper, LifeMenuSection item) {
        helper.setText(R.id.tv_life_menu_head_text, item.header);
    }

    @Override
    protected void convert(BaseViewHolder helper, LifeMenuSection item) {
        ClassifyBo lifeMenuBo = item.t;
        helper.setText(R.id.tv_life_menu_content_text, lifeMenuBo.getClassify()).addOnClickListener(R.id.view_life_menu);
        if (lifeMenuBo.isChecked()){
            helper.setBackgroundColor(R.id.tv_life_menu_content_text, AM.res().getColor(R.color.primary_highlight));
            helper.setTextColor(R.id.tv_life_menu_content_text, AM.res().getColor(R.color.primary_comparison));
        }else {
            helper.setBackgroundColor(R.id.tv_life_menu_content_text, AM.res().getColor(R.color.primary_comparison));
            helper.setTextColor(R.id.tv_life_menu_content_text, AM.res().getColor(R.color.text_999999));
        }
    }
}